home *** CD-ROM | disk | FTP | other *** search
/ ...taking it to the Macs! / ...taking it to the Macs!.iso / Extras / ActiveX Mac SDK / ActiveX SDK / Container Common / CBaseSite.h < prev    next >
Text File  |  1997-01-03  |  5KB  |  139 lines

  1. //
  2. //  CBaseSite.h
  3. //
  4. //  Copyright (C) Microsoft Corporation, 1996
  5. //
  6.  
  7. #ifndef _H_CBaseSite
  8. #define _H_CBaseSite
  9. #pragma once
  10.  
  11. class CInitialDataStreamNotify;         //  Forward reference
  12. class CBindHost;                        //  Forward reference
  13. class CPropertyBag;                        //  Forward reference
  14.  
  15. typedef struct
  16. {
  17.     RgnHandle             ClipRgn;
  18.     Rect                 PortRect;
  19.     PenState            PenState;
  20.     Int16                TextFont;
  21.     Int16                TextMode;
  22.     Int16                TextSize;
  23.     Int16                TextFace;
  24.     RGBColor            ForeColor;
  25.     RGBColor            BackColor;
  26. }
  27. PortState;
  28.  
  29. class CXSite:
  30.     public CBaseCOM,
  31.     public IContainerSite,
  32.     public IControl,
  33.     public IServiceProvider,
  34.     public IThreadScheduler
  35. {
  36.  
  37. public:
  38.  
  39.     //  *** Construction/Destruction ***
  40.     CXSite(void);
  41.     ~CXSite(void);
  42.     static CXSite* CreateSite(void);
  43.  
  44.     // CBaseSite methods //
  45.     STDMETHOD (AddParam) (THIS_ Char8* inName, Char8* inValue) ;
  46.     STDMETHOD (FindControl)(void);
  47.     STDMETHOD (CreateControl) (THIS_ Boolean8 inDoDownload) ;
  48.     STDMETHOD (DestroyControl)(THIS) ;
  49.     STDMETHOD (SetContainerData)(THIS_ IUnknown* inUnkOuter, void* inContainerData) ;
  50.     STDMETHOD (GetContainerData)(THIS_ void** outContainerData) ;
  51.     STDMETHOD (SetBaseURL)(THIS_ Char8* inURL) ;
  52.     STDMETHOD (SetThreadScheduler)(THIS_ ProcPtr inThreadScheduler) 
  53.         { mThreadScheduler = inThreadScheduler; return S_OK; }
  54.  
  55.     //  *** IUnknown methods ***
  56.     STDMETHOD(QueryInterface)(REFIID inRefID, void** outObj);
  57.     STDMETHOD_(ULONG, AddRef)(void) { return CBaseCOM::AddRef(); }
  58.     STDMETHOD_(ULONG, Release)(void) { return CBaseCOM::Release(); }
  59.  
  60.     // **** IContainerSite methods ***
  61.     STDMETHOD (GetContainer)(THIS_ IContainer** outContainer) ;
  62.     STDMETHOD (RequestFocus) (THIS_ Boolean8 inAcquire, FocusSet inFocus) ;
  63.     STDMETHOD (RequestSizeChange) (THIS_ PlatformPoint* ioSize) ;
  64.     STDMETHOD (OnChange) (THIS_ ChangeType inChangeType);
  65.     STDMETHOD (AcquireContext) (THIS_ Uint32 inContextID, DrawContext* outContext) ;
  66.     STDMETHOD (ReleaseContext) (THIS_ DrawContext* inContext) ;
  67.     STDMETHOD (SetIdleTime) (Int32 WaitTicks, Uint32 IdleRefCon) ;
  68.  
  69.     // **** IControl methods ***
  70.     STDMETHOD (Draw) (THIS_ DrawContext* inContext) ;
  71.     STDMETHOD (OnContextChange)(THIS_ UInt32 inContextID, ContextCommand inCommand) ;
  72.     STDMETHOD (GetID)(THIS_ Int32 inBufferSize, Char8* outID) ;
  73.     STDMETHOD (GetUsedArea)(THIS_ PlatformRegion* outUsedArea);
  74.     STDMETHOD (SetFocus)(THIS_ FocusCommand inCommand, FocusSet inFocus) ;
  75.     STDMETHOD (DoMouse)(THIS_ MouseEventType inMouseET, PlatformEvent* inEvent) ;
  76.     STDMETHOD (DoKey)(THIS_ KeyEventType inKeyET, Char8 inChar, PlatformEvent* inEvent) ;
  77.     STDMETHOD (DoActivate)(THIS_ ActivateEventType inActiveET, UInt32 inContextID, PlatformEvent* inEvent) ;
  78.     STDMETHOD (DoSystemEvent)(THIS_ PlatformEvent* inEvent) ;
  79.     STDMETHOD (DoIdle)(THIS_ Uint32 IdleRefCon) ;
  80.  
  81.     //  *** IServiceProvider methods ***
  82.     STDMETHOD(QueryService)(REFGUID inRSID, REFIID inRefID, void** outObj);
  83.  
  84.     // **** IThreadScheduler methods ***
  85.     STDMETHOD(GetScheduler)(THIS_ ProcPtr* outScheduler);
  86.  
  87.  
  88. /********** Public data members *************/
  89.     CLSID            m_clsid;                // This control's class id
  90.     void*            m_ClientInstance;        // Pointer to client instance data
  91.     LPOLESTR        m_pszCodeURL;            // URL to code for this control
  92.     DWORD            m_dwMinimumVersion;        // Minimum version of codebase allowed
  93.     Boolean            m_fHaveInitialStream;    // TRUE  if we have an initial stream
  94.     Char8*            m_BaseURL;                // Base URL to data for this control
  95.  
  96. #ifdef PLUGIN_ADAPTER
  97.     CInitialDataStreamNotify    *m_pInitialDataStreamNotify;
  98.     CNetscapeStreamNotify        *m_pUnattachedList;
  99. #endif
  100.  
  101.     LPUNKNOWN        m_punkObject;
  102.  
  103.  
  104. protected:
  105.  
  106.     void            SavePortState(PlatformPort* Port);
  107.     void            RestorePortState(void);
  108.     void             RemoveSite(CXSite *inSite);
  109.     Uint32            GetCount(void);
  110.     void            FetchSite(short Index, CXSite** outSite);
  111.     void            DrawControl(void);
  112.     
  113.    virtual Boolean8    GetContextID (Int32 inContextIndex, UInt32* outContextID);
  114.     
  115.     
  116. /************** data members ***************/ 
  117.     IUnknown*            mUnkOuter;            // Outer unknown
  118.     IContainer*            mContainerP;        // This control's container
  119.     void*                mContainerData;        // Container-specific data for this control
  120.     Int32                mContextCount;        // Number of contexts for this control
  121.     IObjectWithSite*    mObjSiteP;            // Object Site interface for control
  122.     IControl*            mControlP;            // Primary control interface
  123.     CPropertyBag*        mPropertyBagP;        // Property bag for storing params
  124.     CBindHost*            mBindHostP;            // BindHost for the site;
  125.     ProcPtr                mThreadScheduler;    // Thread Scheduler for hosting application
  126.  
  127.     Boolean8            mHavePort;            //    has the port been acquired?
  128.     GrafPtr                mSavePort;            //    which port should be restored after release draw context
  129.     PortState            mOldPortState;        //    data which should be restored to the current draw context port
  130.  
  131.     Uint32                mCachedActiveContextID;    // cached Active Context ID for delayed control instantiation
  132.     Boolean8            mCachedDraw;            // true if we were told to draw before control was created
  133.     Boolean8            mCachedContextChange;    // true if we were told to change context before control was created
  134.     Boolean8            mDestroyed;            //    control has been destroyed but not site due
  135.                                             //    to ref counting. Added to handle aborted download
  136. };
  137.  
  138. #endif
  139.